#import "SquareSprite.h"
#import "constant.h"


@implementation SquareSprite

-(id) init
{
    if( (self = [super init]) )
    {
        [self setSpriteType:kSPRITE_TYPE_SQUARE];        
        
        self.numberLabel = [CCLabelBMFont labelWithString:@"" fntFile:@"Dakota_white_48.fnt"];
        [self addChild:numberLabel];
    }
    
    return self;
}

-(void) dealloc
{
    [super dealloc];
}

-(void) startActionWithWave:(int)wave
{
	switch (wave) {
		case 1:
			break;
		case 2:
			[self runAction:[CCRepeatForever actionWithAction:[CCRotateBy actionWithDuration:1 angle:180]]];
			break;
		case 3:
			[self runAction:[CCRepeatForever actionWithAction:
							   [CCSequence actions:
								[CCScaleTo actionWithDuration:1 scale:0], 
								[CCScaleTo actionWithDuration:1 scale:[self scaleY]], 
								nil]]];
			break;
		default:
			break;
	}

}
/*
#pragma mark Override Function From GeneralSprite
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
    bool bIsSpriteActive = [super ccTouchBegan:touch withEvent:event];
    
    if(bIsSpriteActive)
    {
        //Only IDLE is able to touch
        if( [self state] != kSPRITE_STATE_IDLE )
            return NO;
        
        [delegate squareSpriteTouchBegan:self];
        return YES;
    }
    
    return NO;
}

-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
    [super ccTouchMoved:touch withEvent:event];
    [delegate squareSpriteTouchMoved:self location:CGPointMake(0, 0)];
}

-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
    [super ccTouchEnded:touch withEvent:event];
    [delegate squareSpriteTouchEnd:self];
}

-(void) startCorrectEffect
{
    [super startCorrectEffect];
    [delegate squareStartCorrectEffect:self];
    
    //CCFadeOut *action1 = [CCFadeOut actionWithDuration:2];
    CCScaleBy *action0 = [CCScaleBy actionWithDuration:0.2 scale:1.1];
    CCScaleTo *action1 = [CCScaleTo actionWithDuration:0.7 scale:0.0];
    CCCallFunc *action2 = [CCCallFunc actionWithTarget:self selector:@selector(finishCorrectEffect)];
    [self runAction: [CCSequence actions:action0, action1, action2, nil] ];
}

-(void) startIncorrectEffect
{
    [super startIncorrectEffect];
    [delegate squareStartIncorrectEffect:self];
    
    CCCallFunc *action1 = [CCCallFunc actionWithTarget:self selector:@selector(finishIncorrectEffect)];
    [self runAction: [CCSequence actions:action1, nil] ];
}

-(void) finishCorrectEffect
{
    [super finishCorrectEffect];
    [delegate squareFinishCorrectEffect:self];
}

-(void) finishIncorrectEffect
{
    [super finishIncorrectEffect];
    [delegate squareFinishIncorrectEffect:self];
}
*/

@end
